package com.atguigu.springcloud;

import com.springcloud.entity.Dept;
import com.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class DeptController_Consumer {
 // private static final  String REST_URL_PREFIX = "http://localhost:8001";
 private static final String REST_URL_PREFIX = "http://MICROSERVICECLOUD-DEPT";

 @Autowired
 private DeptClientService deptService;

 @RequestMapping(value = "/consumer/dept/add")
 public boolean add(Dept dept) {
  return deptService.add(dept);
 }

 @RequestMapping(value = "/consumer/dept/get/{id}")
 public Dept get(@PathVariable(value = "id") Long id) {
  return deptService.get(id);
 }

 @RequestMapping(value = "/consumer/dept/list")
 public List<Dept> list() {
  return deptService.list();

 }
 @RequestMapping(value = "/consumer/dept/test")
 public Map<String,String> test() {
  throw new RuntimeException();


 }
}
